package com.gmail.blackdog1987.onedollar.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by dongguochao on 12/7/15.
 */
@Entity
@Table(name = "t_goods_price", schema = "", catalog = "onedollar")
public class TGoodsPriceEntity {
    private int id;

    @Id
    @Column(name = "id", nullable = false, insertable = true, updatable = true)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private Integer goodsId;

    @Basic
    @Column(name = "goods_id", nullable = true, insertable = true, updatable = false)
    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    private Integer paramId1;

    @Basic
    @Column(name = "param_id1", nullable = true, insertable = true, updatable = false)
    public Integer getParamId1() {
        return paramId1;
    }

    public void setParamId1(Integer paramId1) {
        this.paramId1 = paramId1;
    }

    private String value1;

    @Basic
    @Column(name = "value1", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue1() {
        return value1;
    }

    public void setValue1(String value1) {
        this.value1 = value1;
    }

    private Integer paramId2;

    @Basic
    @Column(name = "param_id2", nullable = true, insertable = true, updatable = false)
    public Integer getParamId2() {
        return paramId2;
    }

    public void setParamId2(Integer paramId2) {
        this.paramId2 = paramId2;
    }

    private String value2;

    @Basic
    @Column(name = "value2", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue2() {
        return value2;
    }

    public void setValue2(String value2) {
        this.value2 = value2;
    }

    private Integer paramId3;

    @Basic
    @Column(name = "param_id3", nullable = true, insertable = true, updatable = false)
    public Integer getParamId3() {
        return paramId3;
    }

    public void setParamId3(Integer paramId3) {
        this.paramId3 = paramId3;
    }

    private String value3;

    @Basic
    @Column(name = "value3", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue3() {
        return value3;
    }

    public void setValue3(String value3) {
        this.value3 = value3;
    }

    private Integer paramId4;

    @Basic
    @Column(name = "param_id4", nullable = true, insertable = true, updatable = false)
    public Integer getParamId4() {
        return paramId4;
    }

    public void setParamId4(Integer paramId4) {
        this.paramId4 = paramId4;
    }

    private String value4;

    @Basic
    @Column(name = "value4", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue4() {
        return value4;
    }

    public void setValue4(String value4) {
        this.value4 = value4;
    }

    private Integer paramId5;

    @Basic
    @Column(name = "param_id5", nullable = true, insertable = true, updatable = false)
    public Integer getParamId5() {
        return paramId5;
    }

    public void setParamId5(Integer paramId5) {
        this.paramId5 = paramId5;
    }

    private String value5;

    @Basic
    @Column(name = "value5", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue5() {
        return value5;
    }

    public void setValue5(String value5) {
        this.value5 = value5;
    }

    private Integer paramId6;

    @Basic
    @Column(name = "param_id6", nullable = true, insertable = true, updatable = false)
    public Integer getParamId6() {
        return paramId6;
    }

    public void setParamId6(Integer paramId6) {
        this.paramId6 = paramId6;
    }

    private String value6;

    @Basic
    @Column(name = "value6", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue6() {
        return value6;
    }

    public void setValue6(String value6) {
        this.value6 = value6;
    }

    private Integer paramId7;

    @Basic
    @Column(name = "param_id7", nullable = true, insertable = true, updatable = false)
    public Integer getParamId7() {
        return paramId7;
    }

    public void setParamId7(Integer paramId7) {
        this.paramId7 = paramId7;
    }

    private String value7;

    @Basic
    @Column(name = "value7", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue7() {
        return value7;
    }

    public void setValue7(String value7) {
        this.value7 = value7;
    }

    private Integer paramId8;

    @Basic
    @Column(name = "param_id8", nullable = true, insertable = true, updatable = false)
    public Integer getParamId8() {
        return paramId8;
    }

    public void setParamId8(Integer paramId8) {
        this.paramId8 = paramId8;
    }

    private String value8;

    @Basic
    @Column(name = "value8", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue8() {
        return value8;
    }

    public void setValue8(String value8) {
        this.value8 = value8;
    }

    private Integer paramId9;

    @Basic
    @Column(name = "param_id9", nullable = true, insertable = true, updatable = false)
    public Integer getParamId9() {
        return paramId9;
    }

    public void setParamId9(Integer paramId9) {
        this.paramId9 = paramId9;
    }

    private String value9;

    @Basic
    @Column(name = "value9", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue9() {
        return value9;
    }

    public void setValue9(String value9) {
        this.value9 = value9;
    }

    private Integer paramId10;

    @Basic
    @Column(name = "param_id10", nullable = true, insertable = true, updatable = false)
    public Integer getParamId10() {
        return paramId10;
    }

    public void setParamId10(Integer paramId10) {
        this.paramId10 = paramId10;
    }

    private String value10;

    @Basic
    @Column(name = "value10", nullable = true, insertable = true, updatable = false, length = 50)
    public String getValue10() {
        return value10;
    }

    public void setValue10(String value10) {
        this.value10 = value10;
    }

    private Integer number;

    @Basic
    @Column(name = "number", nullable = true, insertable = true, updatable = true)
    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    private BigDecimal inputPrice;

    @Basic
    @Column(name = "input_price", nullable = true, insertable = true, updatable = false, precision = 2)
    public BigDecimal getInputPrice() {
        return inputPrice;
    }

    public void setInputPrice(BigDecimal inputPrice) {
        this.inputPrice = inputPrice;
    }

    private BigDecimal oldPrice;

    @Basic
    @Column(name = "old_price", nullable = true, insertable = true, updatable = false, precision = 2)
    public BigDecimal getOldPrice() {
        return oldPrice;
    }

    public void setOldPrice(BigDecimal oldPrice) {
        this.oldPrice = oldPrice;
    }

    private BigDecimal discountPrice;

    @Basic
    @Column(name = "discount_price", nullable = true, insertable = true, updatable = false, precision = 2)
    public BigDecimal getDiscountPrice() {
        return discountPrice;
    }

    public void setDiscountPrice(BigDecimal discountPrice) {
        this.discountPrice = discountPrice;
    }

    private String barCode;

    @Basic
    @Column(name = "bar_code", nullable = true, insertable = true, updatable = false, length = 50)
    public String getBarCode() {
        return barCode;
    }

    public void setBarCode(String barCode) {
        this.barCode = barCode;
    }

    private Timestamp addTime;

    @Basic
    @Column(name = "add_time", nullable = true, insertable = true, updatable = false)
    public Timestamp getAddTime() {
        return addTime;
    }

    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    private Timestamp updateTime;

    @Basic
    @Column(name = "update_time", nullable = true, insertable = true, updatable = true)
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    private Integer status;

    @Basic
    @Column(name = "status", nullable = true, insertable = true, updatable = false)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    private String memo;

    @Basic
    @Column(name = "memo", nullable = true, insertable = true, updatable = false, length = 100)
    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    private Integer isDiscount;

    @Basic
    @Column(name = "is_discount", nullable = true, insertable = true, updatable = false)
    public Integer getIsDiscount() {
        return isDiscount;
    }

    public void setIsDiscount(Integer isDiscount) {
        this.isDiscount = isDiscount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TGoodsPriceEntity that = (TGoodsPriceEntity) o;

        if (id != that.id) return false;
        if (goodsId != null ? !goodsId.equals(that.goodsId) : that.goodsId != null) return false;
        if (paramId1 != null ? !paramId1.equals(that.paramId1) : that.paramId1 != null) return false;
        if (value1 != null ? !value1.equals(that.value1) : that.value1 != null) return false;
        if (paramId2 != null ? !paramId2.equals(that.paramId2) : that.paramId2 != null) return false;
        if (value2 != null ? !value2.equals(that.value2) : that.value2 != null) return false;
        if (paramId3 != null ? !paramId3.equals(that.paramId3) : that.paramId3 != null) return false;
        if (value3 != null ? !value3.equals(that.value3) : that.value3 != null) return false;
        if (paramId4 != null ? !paramId4.equals(that.paramId4) : that.paramId4 != null) return false;
        if (value4 != null ? !value4.equals(that.value4) : that.value4 != null) return false;
        if (paramId5 != null ? !paramId5.equals(that.paramId5) : that.paramId5 != null) return false;
        if (value5 != null ? !value5.equals(that.value5) : that.value5 != null) return false;
        if (paramId6 != null ? !paramId6.equals(that.paramId6) : that.paramId6 != null) return false;
        if (value6 != null ? !value6.equals(that.value6) : that.value6 != null) return false;
        if (paramId7 != null ? !paramId7.equals(that.paramId7) : that.paramId7 != null) return false;
        if (value7 != null ? !value7.equals(that.value7) : that.value7 != null) return false;
        if (paramId8 != null ? !paramId8.equals(that.paramId8) : that.paramId8 != null) return false;
        if (value8 != null ? !value8.equals(that.value8) : that.value8 != null) return false;
        if (paramId9 != null ? !paramId9.equals(that.paramId9) : that.paramId9 != null) return false;
        if (value9 != null ? !value9.equals(that.value9) : that.value9 != null) return false;
        if (paramId10 != null ? !paramId10.equals(that.paramId10) : that.paramId10 != null) return false;
        if (value10 != null ? !value10.equals(that.value10) : that.value10 != null) return false;
        if (number != null ? !number.equals(that.number) : that.number != null) return false;
        if (inputPrice != null ? !inputPrice.equals(that.inputPrice) : that.inputPrice != null) return false;
        if (oldPrice != null ? !oldPrice.equals(that.oldPrice) : that.oldPrice != null) return false;
        if (discountPrice != null ? !discountPrice.equals(that.discountPrice) : that.discountPrice != null)
            return false;
        if (barCode != null ? !barCode.equals(that.barCode) : that.barCode != null) return false;
        if (addTime != null ? !addTime.equals(that.addTime) : that.addTime != null) return false;
        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (memo != null ? !memo.equals(that.memo) : that.memo != null) return false;
        if (isDiscount != null ? !isDiscount.equals(that.isDiscount) : that.isDiscount != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (goodsId != null ? goodsId.hashCode() : 0);
        result = 31 * result + (paramId1 != null ? paramId1.hashCode() : 0);
        result = 31 * result + (value1 != null ? value1.hashCode() : 0);
        result = 31 * result + (paramId2 != null ? paramId2.hashCode() : 0);
        result = 31 * result + (value2 != null ? value2.hashCode() : 0);
        result = 31 * result + (paramId3 != null ? paramId3.hashCode() : 0);
        result = 31 * result + (value3 != null ? value3.hashCode() : 0);
        result = 31 * result + (paramId4 != null ? paramId4.hashCode() : 0);
        result = 31 * result + (value4 != null ? value4.hashCode() : 0);
        result = 31 * result + (paramId5 != null ? paramId5.hashCode() : 0);
        result = 31 * result + (value5 != null ? value5.hashCode() : 0);
        result = 31 * result + (paramId6 != null ? paramId6.hashCode() : 0);
        result = 31 * result + (value6 != null ? value6.hashCode() : 0);
        result = 31 * result + (paramId7 != null ? paramId7.hashCode() : 0);
        result = 31 * result + (value7 != null ? value7.hashCode() : 0);
        result = 31 * result + (paramId8 != null ? paramId8.hashCode() : 0);
        result = 31 * result + (value8 != null ? value8.hashCode() : 0);
        result = 31 * result + (paramId9 != null ? paramId9.hashCode() : 0);
        result = 31 * result + (value9 != null ? value9.hashCode() : 0);
        result = 31 * result + (paramId10 != null ? paramId10.hashCode() : 0);
        result = 31 * result + (value10 != null ? value10.hashCode() : 0);
        result = 31 * result + (number != null ? number.hashCode() : 0);
        result = 31 * result + (inputPrice != null ? inputPrice.hashCode() : 0);
        result = 31 * result + (oldPrice != null ? oldPrice.hashCode() : 0);
        result = 31 * result + (discountPrice != null ? discountPrice.hashCode() : 0);
        result = 31 * result + (barCode != null ? barCode.hashCode() : 0);
        result = 31 * result + (addTime != null ? addTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (memo != null ? memo.hashCode() : 0);
        result = 31 * result + (isDiscount != null ? isDiscount.hashCode() : 0);
        return result;
    }

    public String generateAttr(){
        String result = "";
        if(value1==null||value1.length()==0){
            return result;
        }
        result += value1;
        if(value2==null||value2.length()==0){
            return result;
        }
        result = result + "," + value2;
        if(value3==null||value3.length()==0){
            return result;
        }
        result = result + "," + value3;
        if(value4==null||value4.length()==0){
            return result;
        }
        result = result + "," + value4;
        if(value5==null||value5.length()==0){
            return result;
        }
        result = result + "," + value5;
        if(value6==null||value6.length()==0){
            return result;
        }
        result = result + "," + value7;
        if(value7==null||value7.length()==0){
            return result;
        }
        result = result + "," + value1;
        if(value8==null||value8.length()==0){
            return result;
        }
        result = result + "," + value8;
        if(value9==null||value9.length()==0){
            return result;
        }
        result = result + "," + value9;
        if(value10==null||value10.length()==0){
            return result;
        }
        result = result + "," + value10;
        return result;
    }
}
